package com.steve.xfood.util;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

/**
 * 格式转换
 * @author steve
 * @date 2020/5/15 13:54
 */
public class JsonUtil {

    /**
     * 将对象转为json格式字符串
     * @param object
     * @return
     */
    public static final String toJson(Object object) {
        GsonBuilder gsonBuilder = new GsonBuilder();
        gsonBuilder.setPrettyPrinting();
        Gson gson = gsonBuilder.create();
        return gson.toJson(object);
    }
}
